package com.hzj.controller;

import com.hzj.service.UserService;
import com.mysql.jdbc.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AjaxController {
    @Autowired
    @Qualifier("userServiceImpl")
    private UserService userService;

    @RequestMapping("/getUserByName")
    public String getUserByName(String userName){
        String msg;
        if (StringUtils.isNullOrEmpty(userName)){
            msg="NULL";
        }else if (userService.queryUserByName(userName)!=null){
            msg="false";
        }else msg="ok";
        return msg;
    }
}
